package de.baumann.browser.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import de.baumann.browser.R;
import de.baumann.browser.api.net.vo.Transfer;


/**
*@author:
*@date:2019/7/10 11:34
*@discription: 转赠列表适配器
*/
@SuppressWarnings("ALL")
public class TransferAdapter extends BaseQuickAdapter<Transfer,BaseViewHolder> {

    public TransferAdapter(int layoutResId) {
        super(layoutResId);
    }

    @SuppressWarnings("AliDeprecation")
    @Override
    protected void convert(BaseViewHolder holder, Transfer transfer) {

         TextView mTransferName;
         TextView mTransferTime;
         TextView mTransferedNum;

        mTransferName = holder.getView(R.id.tvTransfername);
        mTransferTime = holder.getView(R.id.tvTransferTime);
        mTransferedNum = holder.getView(R.id.tvTransferNum);

        mTransferName.setText(transfer.getTo_user_name());
        mTransferTime.setText(transfer.getTrans_date());

        switch (transfer.getTransType()) {
            case 1:
                mTransferedNum.setText("-" + transfer.getTrans_number());
                mTransferedNum.setTextColor(mContext.getResources().getColor(R.color.red_ff5347));
                break;
            case 2:
                mTransferedNum.setText("+" + transfer.getTrans_number());
                mTransferedNum.setTextColor(mContext.getResources().getColor(R.color.text_light));
                break;
            default:
        }
    }
}
